﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for AdminBLL
/// </summary>
public class AdminBLL
{
    MasterPasswordDataSetTableAdapters.AdminMasterPasswordTableAdapter adminMaster = new MasterPasswordDataSetTableAdapters.AdminMasterPasswordTableAdapter();
    AdminloginDataSetTableAdapters.AdminLoginTableAdapter adminlgn = new AdminloginDataSetTableAdapters.AdminLoginTableAdapter();
    AdminAddsSeetinsDataSetTableAdapters.AddsSettingTableAdapter adminAdds = new AdminAddsSeetinsDataSetTableAdapters.AddsSettingTableAdapter();
    AdminCatogriesDataSetTableAdapters.CategoriesTableAdapter adminCate = new AdminCatogriesDataSetTableAdapters.CategoriesTableAdapter();
    ManageDishDataSetTableAdapters.DishTableAdapter AdminDishMan = new ManageDishDataSetTableAdapters.DishTableAdapter();
    AdminNotificationDataSetTableAdapters.NotificationSettingTableAdapter AdminNotif = new AdminNotificationDataSetTableAdapters.NotificationSettingTableAdapter();
    AdminFinalOrderDataSetTableAdapters.FinalOrderTableAdapter adminFinalOrder = new AdminFinalOrderDataSetTableAdapters.FinalOrderTableAdapter();
    AdminCompanyDataSetTableAdapters.CompanyNameTableAdapter adminComp = new AdminCompanyDataSetTableAdapters.CompanyNameTableAdapter();
    AdminDefaultSettingDataSetTableAdapters.DefaultSettingTableAdapter AdminDefault = new AdminDefaultSettingDataSetTableAdapters.DefaultSettingTableAdapter();


	public AdminBLL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public string getmasterpass()
    {
        return (string)adminMaster.SelectMasterPassword();
    }
    public AdminAddsSeetinsDataSet.AddsSettingDataTable getPrsentdata()
    {
        return adminAdds.GetAddsData();
    }
    public void insertAdds(string AN, string image, string link, string status)
    {
        adminAdds.InsertQueryADDS(AN, image, link, status);
    }
    public void updateadd(int id, string Addname, string link, string imagename, string status)
    {
        adminAdds.UpdateQuery(Addname, imagename, link, status, id);
    }
    public void updateaddwithoutimage(int id, string Addname, string link, string status)
    {
        adminAdds.UpdateQueryWihoutadd(Addname, link, status, id);
    }
    public int Adminlogin(string AU, string PS)
    {
        return Convert.ToInt32(adminlgn.AdminLogin(AU, PS));
    }
    public string adminname(string AUN)
    {
        return (string)adminlgn.GetAdminName(AUN);
    }
    public AdminCatogriesDataSet.CategoriesDataTable categoriesdata()
    {
        return adminCate.GetDataForEdit();
    }
    public void updateCategories(int ID, string Catg, string status)
    {
        adminCate.UpdateCategories(Catg, status, ID);
    }
    public AdminCatogriesDataSet.CategoriesDataTable getcatgforDropDown()
    {
        return adminCate.GetDataDDown();
    }
    public ManageDishDataSet.DishDataTable getDishForEdit(int Catg)
    {
        return AdminDishMan.GetDataBy(Catg);
    }
    public DataTable getcatgforDropDownDT()
    {
        return adminCate.GetDataDDown();
    }
    public void UpdateDish(int Id, string DishName, string Image, int Stock, int Price, int Catg, string Commnt, string Status)
    {
        AdminDishMan.UpdateQueryDish(DishName, Image, Stock, Price, Catg, Commnt, Status, Id);
    }
    public void UpdateDishWithozImage(int Id, string DishName, int Stock, int Price, int Catg, string Commnt, string Status)
    {
        AdminDishMan.UpdateQueryWithoutImage(DishName, Stock, Price, Catg, Commnt, Status, Id);
    }
    public AdminNotificationDataSet.NotificationSettingDataTable GetNotifData()
    {
        return AdminNotif.GetDataForNotification();
    }
    public void UpdateNotificStatus(string RSD, string ONF, string Status, int Id)
    {
        AdminNotif.UpdateQueryForNotif(RSD, ONF, Status, Id);
    }
    public void AdminRegester(string AUN, string APS, string Email, string AN)
    {
        adminlgn.InsertAdminRegester(AUN, APS, Email, AN);
    }
    public int adminAvalible(string AUN)
    {
        return (int)adminlgn.ScalarChekAvaliable(AUN);
    }
    public void InsertDishNew(string DishName, string Image, int Stock, int Price, int Catg, string Commnt, string Status)
    {
        AdminDishMan.InsertNewDish(DishName, Image, Stock, Price, Catg, Commnt, Status);
    }
    public AdminFinalOrderDataSet.FinalOrderDataTable show_todays_order(DateTime DT)
    {
        return adminFinalOrder.GetDataByToday(DT);
    }
    public AdminCompanyDataSet.CompanyNameDataTable GetCompany()
    {
        return adminComp.GetData();
    }
    public void InsertCompay(int ID2, string CN)
    {
        adminComp.InsertCompanyName(ID2, CN);
    }
    public void UpdateComp(int Id, int ID2, string CN)
    {
        adminComp.UpdateCompany(ID2, CN, Id);
    }
    public int SelectMaxIDCompany()
    {
        return (int)adminComp.SelectMaxID();
    }
    public AdminFinalOrderDataSet.FinalOrderDataTable returnsearch(string ID, int OID)
    {
        return adminFinalOrder.SearchbyIDandDT(ID, OID);
    }
    public void AddWB(int WBLAD, int Id)
    {
        adminFinalOrder.UpdateWB(WBLAD, Id);
    }
    public DataSet GETPD(string ID)
    {
        DAL DALObj = new DAL();
        return DALObj.PD(ID);
    }
    public AdminDefaultSettingDataSet.DefaultSettingDataTable Defaultsettng()
    {
        return AdminDefault.GetData();
    }
    public void DefaultStngChange(int ID, string AdvsSett, string Notfg, string Dishstng)
    {
        AdminDefault.UpdateDefaultSetting(AdvsSett, Notfg, Dishstng, ID);
    }
    public void ChangeMasterPassword(string MasterPass, int ID)
    {
        adminMaster.UpdateMasterPassword(MasterPass, ID);
    }
    public AdminFinalOrderDataSet.FinalOrderDataTable show_todays_order_Filter(DateTime DT1, DateTime DT2)
    {
        return adminFinalOrder.FilterDishAdmin(DT1, DT2);
    }    
    public string GetAdminPassword(string AUN, string Email)
    {
        return (string)adminlgn.GetPassowrdAdmin(AUN, Email);
    }
}